//package com.freemyleft.left.left_app.sign;
//
//import android.os.Bundle;
//import android.support.annotation.NonNull;
//import android.support.annotation.Nullable;
//import android.support.design.widget.TextInputEditText;
//import android.util.Log;
//import android.view.View;
//import android.widget.Toast;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONObject;
//import com.freemyleft.left.left_app.R;
//import com.freemyleft.left.left_app.R2;
//import com.freemyleft.left.left_app.mian.index.BottomDelegate;
//import com.freemyleft.left.zapp.delegates.LeftDelegate;
//import com.freemyleft.left.zapp.net.RestClient;
//import com.freemyleft.left.zapp.net.callback.ISuccess;
//import com.freemyleft.left.zapp.util.EditTextUtil;
//import com.freemyleft.left.zapp.util.LeftPreference;
//
//import butterknife.BindView;
//import butterknife.OnClick;
//
///**
// * Created by FreeMyleft on 2018/1/23.
// */
//
//public class QiYeXingXiDelegate extends LeftDelegate {
//    @BindView(R2.id.yingyezhizh)
//    TextInputEditText yinyezhizhao;
//    @BindView(R2.id.yewubianhao)
//    TextInputEditText yewubiahao;
//    private static String mPhone;
//    private static String mPassWord;
//    private static String mcode;
//
//    @OnClick(R2.id.advanceInCash_back)
//    void back() {
//        getActivity().onBackPressed();
//    }
//
//    @OnClick(R2.id.denglu_btn)
//    void denglu() {
//        String myewubianhao = yewubiahao.getText().toString();
//        String myinyezhizhoa = yinyezhizhao.getText().toString();
//        if (EditTextUtil.ChekText(myinyezhizhoa, yinyezhizhao)) {
//            RestClient.builder().url(API + "/m/register.do")
//                    .params("mobile", mPhone)
//                    .params("code", mcode)
//                    .params("password", mPassWord)
//                    .params("account", myewubianhao)
//                    .params("business_name", myinyezhizhoa)
//                    .success(new ISuccess() {
//                        @Override
//                        public void onSuccess(String responnse) {
//                            JSONObject obj = JSON.parseObject(responnse);
//                            Log.e("TAG", responnse);
//                            String res_status = obj.getString("res_status");
//                            String res_msg = obj.getString("res_msg");
//                            JSONObject res_data = obj.getJSONObject("res_data");
//                            if (res_status.equals("1")) {
//                                Toast.makeText(getContext(), res_msg, Toast.LENGTH_SHORT).show();
//                                String tokenid = res_data.getString("tokenid");
//                                String userid = res_data.getString("shopid");
//                                String business_name = res_data.getString("business_name");
//                                String mobile = res_data.getString("mobile");
//                                String portrait = res_data.getString("portrait");
//                                LeftPreference.addCustomAppProfile("tokenid", tokenid);
//                                LeftPreference.addCustomAppProfile("mobile", mobile);
//                                LeftPreference.addCustomAppProfile("business_name", business_name);
//                                LeftPreference.addCustomAppProfile("portrait", portrait);
//                                LeftPreference.addCustomAppProfile("shopid", userid);
//                                getSupportDelegate().start(new BottomDelegate(0));
//                            } else {
//                                Toast.makeText(getContext(), res_msg, Toast.LENGTH_SHORT).show();
//                            }
//
//                        }
//                    }).buid().post();
//        }
//    }
//
//    @Override
//    public Object setLayout() {
//        return R.layout.delegate_qiyexingxi;
//    }
//
//    public static QiYeXingXiDelegate newInstance(String[] info) {
//        Bundle args = new Bundle();
//        args.putSerializable("sigup", info);
//        args.putSerializable("kuaijiedenglu", info);
//        QiYeXingXiDelegate fragment = new QiYeXingXiDelegate();
//        fragment.setArguments(args);
//        return fragment;
//    }
//
//    @Override
//    public void onBindView(@Nullable Bundle savedInstanceState, @NonNull View rootView) {
//        String[] info1 = (String[]) getArguments().getSerializable("sigup");
//        String[] info = (String[]) getArguments().getSerializable("kuaijiedenglu");
//        if (info1 != null) {
//            mPhone = info1[0];
//            mPassWord = info1[1];
//            mcode = info1[2];
//        } else {
//            mPhone = info[0];
//            mPassWord = info[1];
//            mcode = info[2];
//        }
//    }
//}
